home *** CD-ROM | disk | FTP | other *** search
-
- insertion_sort( int data[], int first, int last )
- {
- int i;
- int j;
- int temp;
-
- for ( i=first+1 ; i <= last ; i++ )
- {
- temp = data[i];
- j = i-1;
- while (j >= first)
- {
- if ( data[j] > temp )
- {
- data[j+1] = data[j];
- j--;
- }
- else
- break;
- ]
- data[ j+1 ] = temp;
- }
- }
-
- The Insertion Sort
- Figure 16
-
-